﻿using Godot;
public class AlgaeBlock : BlockMaterial
{
    public AlgaeBlock() : base("algae")
    {
        DisPlayName = "海草";
        Collide = false;
        TickEvent = Tick;
        BreakEvent = OnBreak;
    }
    public void Tick(UpdataTickEvent e)
    {
        
        BlockData down = e.BottomBlock();
        if (down != null && down.Name != "sand")
        {
            e.world.SetBlock(e.Position + new Vector3I(0, -1), Materials.Water);
            e.world.SetBlock(e.Position, Materials.Air);
        }
    }
    public bool OnBreak(PlayerBreakBlockEvent e)
    {
        e.world.SetBlock(e.Position, Materials.Water);
        return false;
    }
}